package com.m3958.vertxio.vertxsmsservice;

import java.sql.SQLException;

import javax.sql.DataSource;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.mchange.v2.c3p0.DataSources;

public class Ds {

	private ComboPooledDataSource cpds;
	
	public ComboPooledDataSource getCpds() {
		return cpds;
	}

	public void setCpds(ComboPooledDataSource cpds) {
		this.cpds = cpds;
	}
	
	private DataSource ds_unpooled;

	public Ds(){
		
//		try {
//			ds_unpooled = DataSources.unpooledDataSource("jdbc:mysql://127.0.0.1/m3958vote", 
//			        "m3958voteuser", 
//			        "131415");
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}
//		
		cpds = new ComboPooledDataSource();
		cpds.setJdbcUrl( "jdbc:mysql://127.0.0.1/vertxtest?characterEncoding=utf8" );
		cpds.setUser("vertxuser"); 
		cpds.setPassword("1827837");
			
		// the settings below are optional -- c3p0 can work with defaults
		cpds.setMinPoolSize(5);                                     
		cpds.setAcquireIncrement(5);
		cpds.setMaxPoolSize(20);
	}

	public DataSource getDs_unpooled() {
		return ds_unpooled;
	}

	public void setDs_unpooled(DataSource ds_unpooled) {
		this.ds_unpooled = ds_unpooled;
	}
}
